#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'arrow'
__explain__ = ''

from django.db import models


class BaseManager(models.Manager):
    def get_queryset(self):
        return super().get_queryset().filter(is_deleted=0)  # 返回状态是未删除的记录


class BaseModel(models.Model):
    is_deleted = models.IntegerField(verbose_name="是否删除(0正常，1删除）", default=0)
    create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="更新时间")

    objects = BaseManager()

    class Meta:
        abstract = True
